package map;

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.Input;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.geom.Vector2f;

import constans.Global;
import constans.ResourceManager;

public class Sector {

	private Image background;
	Vector2f position;
	static int size = 199;
	
	public Sector(int x, int y)
	{
		position = new Vector2f(x,y);
		if(position.y == 0)
		{
			if(x == 0)
				background = ResourceManager.getImage("mapLT");	
			else if(x == (Global.MAP_SIZE_X/Sector.size - 1) * size)
				background = ResourceManager.getImage("mapRT");
			else
				background = ResourceManager.getImage("mapT");				
		}
		else if(y == ( Global.MAP_SIZE_Y/Sector.size - 1  )* size)
		{
			if(x == 0)
				background = ResourceManager.getImage("mapLB");	
			else if(x ==( Global.MAP_SIZE_X/Sector.size - 1 ) * size)
				background = ResourceManager.getImage("mapRB");
			else
				background = ResourceManager.getImage("mapB");	
		}			
		else
		{
			if(x == 0)
				background = ResourceManager.getImage("mapL");	
			else if(x ==( Global.MAP_SIZE_X/Sector.size - 1 ) * size)
				background = ResourceManager.getImage("mapR");
			else
				background = ResourceManager.getImage("mapM");	
		}
	}
	public void render(GameContainer container, Graphics g) throws SlickException
	{	
		position.sub(Map.shift);
		background.draw((int)position.x,(int)position.y);
		position.add(Map.shift);
	}
}
